/*
 * @Author: KoaLaYT 
 * @Date: 2019-10-11 17:56:25 
 * @Desc: restful接口的权限验证
 * @Last Modified by: KoaLaYT
 * @Last Modified time: 2019-10-11 17:58:20
 */

import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
// import { checkPermission } from './../decorator/login.decorator';

@Injectable()
export class AuthGuard implements CanActivate {
    async canActivate(context: ExecutionContext): Promise<boolean> {
        const {
            headers: { authorization: uid },
            body: { permission },
        } = context.switchToHttp().getRequest();

        // return Boolean(await checkPermission(permission, uid));
        return true;
    }
}
